﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iLangl
{
	public enum eSeverity
	{
		Unknown = 0,
		Low = 2,
		Medium = 4,
		High = 8,
		Critical = 16
	}

	public class ErrorSeverity
	{
		public const String Unknown = "Unknown";
		public const String Low = "Low";
		public const String Medium = "Medium";
		public const String High = "High";
		public const String Critical = "Critical";
		
		public static String GetSeverity(eSeverity severity)
		{
			switch (severity)
			{
				case eSeverity.Critical:
					return Critical;
				case eSeverity.High:
					return High;
				case eSeverity.Low:
					return Low;
				case eSeverity.Medium:
					return Medium;
			}

			return Unknown;
		}

		public static eSeverity GetSeverity(String severity)
		{
			if (string.Compare(Low, severity, true) == 0)
			{
				return eSeverity.Low;
			}

			if (string.Compare(Critical, severity, true) == 0)
			{
				return eSeverity.Critical;
			}
			if (string.Compare(High, severity, true) == 0)
			{
				return eSeverity.High;
			}

			if (string.Compare(Medium, severity, true) == 0)
			{
				return eSeverity.Medium;
			}


			return eSeverity.Unknown;
		}
	}
}
